﻿using S7.Net.Types;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Api.Shared.Model
{
    public class DB33Ioc : INotifyPropertyChanged
    {
        private bool b1;
        private bool b2;
        public bool B1
        {
            get => b1;
            set
            {
                if (b1 != value && value == true)
                {
                    NotifyPropertyChanged();
                }
                b1 = value;
            }
        }

        public bool B2
        {
            get => b2;
            set
            {
                if (b2 != value && value == true)
                {
                    NotifyPropertyChanged();
                }
                b2 = value;
            }
        }

        public bool B3 { get; set; }
        public short S1 { get; set; }
        public short S2 { get; set; }
        public short S3 { get; set; }

        public float R1 { get; set; }
        public float R2 { get; set; }
        public float R3 { get; set; }


        [S7String(S7StringType.S7String, 30)]
        public string Str { get; set; } = string.Empty;


        public virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }




        public event PropertyChangedEventHandler? PropertyChanged;
    }
}
